#ifndef __SEARCHERSERVER_H__
#define __SEARCHERSERVER_H__
#include "ThreadPool.h"
#include "TcpServer.h"

class SearcherServer
{
public:
    SearcherServer(size_t threadNum,size_t queSize,const string & ip,unsigned short port,
                   KeyRecommander* pKeyRecommander,
                   WebPageSearcher* pWebPageSearcher,
                   LRUCache* pLRUCache);
    ~SearcherServer();
    void start();
    void stop();
    void onNewConnectiion(const TcpConnectionPtr &conn);
    void onMessage(const TcpConnectionPtr &conn);
    void onClose(const TcpConnectionPtr &conn);

private:
    ThreadPool _pool;
    TcpServer _server;
    KeyRecommander* _pKeyRecommander;
    WebPageSearcher* _pWebPageSearcher;
    LRUCache* _pLRUCache;
};

#endif
